﻿using CleanArchitecture.Core.SharedKernel;
using System;
using System.Collections.Generic;

namespace CleanArchitecture.Infrastructure.Entities.Business
{
    /// <summary>
    /// 业务前端网站导航菜单
    /// DavidLee 2020/03/27 根据业务增加链接跳转和布局功能
    /// </summary>
    public partial class Column : BaseEntity
    {
        #region Field
        /// <summary>
        /// DavidLee 2019/11/23命名符合EF Core驼峰规范，否则报错，见AdminUser说明
        /// </summary>
        private ICollection<AdminRoleBusColumnMapping> _adminroleBusinessColumnMappings;
        #endregion
        /// <summary>
        /// Gets or sets the Foreign Key of LanguageEntity language identifier
        /// </summary>
        public int FKLanguageId { get; set; }
        /// <summary>
        /// Gets or sets the Parent Id of the category item
        /// </summary>
        public int PID { get; set; }
        /// <summary>
        /// Gets or sets the ColumnType
        /// </summary>
        public EntityEnumConfig.ColumnType ColumnType { get; set; }
        /// <summary>
        /// 栏目深度，用于辩识栏目为一级或二/三/四级分类
        /// </summary>
        public int Level { get; set; }
        /// <summary>
        /// Gets or set the Column MetaKeyWords For Seo
        /// </summary>
        public string MetaKeyWords { get; set; }

        /// <summary>
        /// Gets or sets the MetaDescription for column description or Seo
        /// </summary>
        public string MetaDescription { get; set; }

        /// <summary>
        /// Gets or sets the SeoTitle For Front Page Html Tag
        /// </summary>
        public string MetaTitle { get; set; }

        /// <summary>
        /// Gets or sets the Name of the Column
        /// </summary>
        public string DisplayName { get; set; }
        /// <summary>
        /// Gets or sets the SubTitle of the Column like English Display
        /// </summary>
        public string SubTitle { get; set; }         
        /// <summary>
        /// 栏目页面展示模板名称(列表)，结合.net core地址重写(UrlRewrite)中间件功能实现
        /// 页面布局展示
        /// </summary>
        public string LayoutListTemplate { get; set; }
        /// <summary>
        /// 栏目页面展示模板名称(列表)，结合.net core地址重写(UrlRewrite)中间件功能实现
        /// 页面布局展示
        /// </summary>
        public string LayoutDetailTemplate { get; set; }
        /// <summary>
        /// 栏目对应展示页面布局类型： 单页详情展示/列表布局展示
        /// </summary>
        public EntityEnumConfig.PageLayoutType LayoutType { get; set; }
        /// <summary>
        /// Gets or sets whether to Display the Column In FrontPage Navigation
        /// </summary>
        public EntityEnumConfig.YesorNo IsDisplay { get; set; }
        /// <summary>
        /// Gets or sets if column has Icon Image
        /// 以分号分隔，如"1;/uploaded/Image/aaa.png"， "2;http://www.qiniu.com/ssfdf.jpb"
        /// 分号前存储FileUpload表对应的图片Id,分号后为文件保存路径
        /// </summary>
        public string IconImageUrl { get; set; }
        /// <summary>
        /// Gets or sets if column has Cover Image
        /// 以分号分隔，如"1;/uploaded/Image/aaa.png"， "2;http://www.qiniu.com/ssfdf.jpb"
        /// 分号前存储FileUpload表对应的图片Id,分号后为文件保存路径
        /// </summary>
        public string CoverImageUrl { get; set; }
        /// <summary>
        /// if the navi menu of the category it has url to redirecte to other page
        /// otherwise its a navi item
        /// </summary>
        public string UrlRoute { get; set; }
        /// <summary>
        /// Url redirect or open new window for url target
        /// </summary>
        public EntityEnumConfig.UrlTarget UrlTarget { get; set; }
        /// <summary>
        /// Gets or sets the newslist or other items to display of the number for the column page
        /// </summary>
        public int PageSize { get; set; }
        /// <summary>
        /// Gets or set the Available pagesize to display the number of items 
        /// </summary>
        public string PageSizeOptions { get; set; }
        /// <summary>
        /// Gets or sets the state of the record of the category item is not delete
        /// </summary>
        public EntityEnumConfig.YesorNo IsActive { get; set; }

        public int DisplayOrder { get; set; }

        public DateTime CreatedOnTimeUtc { get; set; }

        public DateTime UpdatedOnTimeUtc { get; set; }

        /// <summary>
        /// Gets or sets the permission record column-role mappings
        /// </summary>
        public virtual ICollection<AdminRoleBusColumnMapping> AdminroleBusinessColumnMappings
        {
            get => _adminroleBusinessColumnMappings ?? (_adminroleBusinessColumnMappings = new List<AdminRoleBusColumnMapping>());
            protected set => _adminroleBusinessColumnMappings = value;
        }
    }
}
